package cn.edu.scau.cmi.shishuai.singleton.model;

import java.util.HashSet;
import java.util.Set;



public class Marshal {
	private String name;
	public static Set<Marshal> marshalSet=new HashSet<Marshal>();
	public static boolean isFull = false;
	
	private Marshal(String name) {
		this.setName(name);
	}
	
	
	public static Marshal addInstance(String name) {
		if(marshalSet.size()<10) {
			Marshal marshal=new Marshal(name);
			marshalSet.add(marshal);
			return marshal;
		}
		else {
			isFull = true;
			//System.out.println("对不起，已经有十个元帅了，"+name+"不能再是元帅！");
		}
		return null;
		
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
}
